#define DEBUG
#include <cstdio>

using namespace std;

typedef long double ld;

const int maxn=100000;

int main() {
  freopen("dice.in", "r", stdin);
  freopen("dice.out", "w", stdout);

  static ld p[7];
  for (int i=1; i<=6; i++) {
    scanf("%LF", p+i);
  }
  int n;
  scanf("%d", &n);

  static ld f[maxn+1][7], g[maxn+1][7], h[maxn+1][7];
  for (int i=1; i<=6; i++) {
    f[1][i] = p[i], g[1][i] = i*p[i];
  }
  for (int i=2; i<=n; i++) {
    for (int j=1; j<=6; j++) {
      for (int k=1; k<=6; k++) {
	if (j!=k) {
	  ld np=p[j]/(1-p[k]);
	  f[i][j] += f[i-1][k]*np;
	  g[i][j] += g[i-1][k]*np+j*f[i-1][k]*np;
	}
      }
    }
  }

  ld e=0;
  for (int i=1; i<=6; i++) {
    e += g[n][i];
  }

  for (int i=1; i<=6; i++) {
    h[1][i] = (i-e)*(i-e)*p[i];
    g[1][i] = (i-e)*p[i];
  }
  for (int i=2; i<=n; i++) {
    for (int j=1; j<=6; j++) {
      g[i][j] = h[i][j] = 0;
      for (int k=1; k<=6; k++) {
	if (j!=k) {
	  ld np=p[j]/(1-p[k]);
	  g[i][j] += g[i-1][k]*np+j*f[i-1][k]*np;
	  h[i][j] += (h[i-1][k]+j*2*g[i-1][k]+j*j*f[i-1][k])*np;
	}
      }
    }
  }

  ld ans=0;
  for (int i=1; i<=6; i++) {
    ans += h[n][i];
  }
  printf("%LF\n%LF", e, ans);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
